import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/login',
      name: 'login',
      component: resolve => require(['@/views/Login'], resolve)
    },
    {
      path: '/',
      component: resolve => require(['@/views/Layout'], resolve),
      redirect: '/index',
      children: [
        {
          path: 'index',
          meta: {
            title: '首页'
          },
          component: resolve => require(['@/views/index/index'], resolve)
        },
        {
          path: 'study',
          meta: {
            title: '学习中心'
          },
          component: resolve => require(['@/views/study/index'], resolve)
        },
        {
          path: 'meeting',
          meta: {
            title: '会议'
          },
          component: resolve => require(['@/views/meeting/index'], resolve)
        },
        {
          path: 'scope',
          meta: {
            title: '园地'
          },
          component: resolve => require(['@/views/scope/index'], resolve)
        },
        {
          path: 'mine',
          meta: {
            title: '我的'
          },
          component: resolve => require(['@/views/mine/index'], resolve)
        }
      ]
    },
    {
      path: '/friend',
      component: resolve => require(['@/views/header'], resolve),
      children: [
        {
          path: 'send',
          meta: {
            title: '发布朋友圈'
          },
          component: resolve => require(['@/views/scope/send'], resolve)
        },
        {
          path: 'comment/:id',
          meta: {
            title: '评论'
          },
          component: resolve => require(['@/views/scope/comment'], resolve)
        }
      ]
    },
    {
      path: '/news',
      component: resolve => require(['@/views/header'], resolve),
      children: [
        {
          path: '',
          meta: {
            title: '党建新闻'
          },
          component: resolve => require(['@/views/index/news/index'], resolve)
        },
        {
          path: 'detail',
          meta: {
            title: '党建新闻'
          },
          component: resolve => require(['@/views/index/news/detail'], resolve)
        }
      ]
    },
    {
      path: '/subject',
      component: resolve => require(['@/views/header'], resolve),
      children: [
        {
          path: '',
          meta: {
            title: '专题专栏'
          },
          component: resolve => require(['@/views/index/subject/index'], resolve)
        },
        {
          path: 'list',
          meta: {
            title: '专题专栏'
          },
          component: resolve => require(['@/views/index/subject/list'], resolve)
        },
        {
          path: 'detail/new',
          meta: {
            title: '专题新闻'
          },
          component: resolve => require(['@/views/index/subject/detail-new'], resolve)
        },
        {
          path: 'detail/video',
          meta: {
            title: '专题视频'
          },
          component: resolve => require(['@/views/index/subject/detail-video'], resolve)
        }
      ]
    },
    {
      path: '/dynamic-organization',
      component: resolve => require(['@/views/header'], resolve),
      children: [
        {
          path: '',
          meta: {
            title: '基层动态'
          },
          component: resolve => require(['@/views/index/dynamic-organization/index'], resolve)
        },
        {
          path: 'detail',
          meta: {
            title: '基层动态'
          },
          component: resolve => require(['@/views/index/news/detail'], resolve)
        }
      ]
    },
    {
      path: '/dynamic-party',
      component: resolve => require(['@/views/header'], resolve),
      children: [
        {
          path: '',
          meta: {
            title: '党委动态'
          },
          component: resolve => require(['@/views/index/dynamic-party/index'], resolve)
        },
        {
          path: 'detail',
          meta: {
            title: '党委动态'
          },
          component: resolve => require(['@/views/index/news/detail'], resolve)
        }
      ]
    },
    {
      path: '/party-member',
      component: resolve => require(['@/views/header'], resolve),
      children: [
        {
          path: '',
          meta: {
            title: '党员先锋'
          },
          component: resolve => require(['@/views/index/party-member/index'], resolve)
        },
        {
          path: 'detail',
          meta: {
            title: '党员先锋'
          },
          component: resolve => require(['@/views/index/news/detail'], resolve)
        },
        {
          path: 'detail/:id',
          meta: {
            title: '先锋榜样'
          },
          component: resolve => require(['@/views/index/party-member/detail'], resolve)
        }
      ]
    },
    {
      path: '/party-pioneer',
      component: resolve => require(['@/views/header'], resolve),
      children: [
        {
          path: '',
          meta: {
            title: '党建简报'
          },
          component: resolve => require(['@/views/index/party-pioneer/index'], resolve)
        },
        {
          path: 'detail',
          meta: {
            title: '党建简报'
          },
          component: resolve => require(['@/views/index/news/detail'], resolve)
        }
      ]
    },
    {
      path: '/index-ranking',
      component: resolve => require(['@/views/header'], resolve),
      children: [
        {
          path: '',
          meta: {
            title: '排行榜'
          },
          component: resolve => require(['@/views/index/ranking/index'], resolve)
        }
      ]
    },
    {
      path: '/study-center',
      component: resolve => require(['@/views/header'], resolve),
      children: [
        {
          path: 'course/video',
          meta: {
            title: '视频学习'
          },
          component: resolve => require(['@/views/study/course-video'], resolve)
        },
        {
          path: 'course/file',
          meta: {
            title: '文件学习'
          },
          component: resolve => require(['@/views/study/course-file'], resolve)
        },
        {
          path: 'record/:type',
          meta: {
            title: '学习记录'
          },
          component: resolve => require(['@/views/study/records'], resolve)
        },
        {
          path: 'exam',
          meta: {
            title: '考试中心'
          },
          component: resolve => require(['@/views/study/exam'], resolve)
        },
        {
          path: 'note',
          meta: {
            title: '笔记中心'
          },
          component: resolve => require(['@/views/study/note'], resolve)
        },
        {
          path: 'ranking',
          meta: {
            title: '学习排名'
          },
          component: resolve => require(['@/views/study/ranking'], resolve)
        },
        {
          path: 'detail/video/:id',
          meta: {
            title: '视频学习'
          },
          component: resolve => require(['@/views/study/detail-video'], resolve)
        },
        {
          path: 'detail/file/:id',
          meta: {
            title: '文件学习'
          },
          component: resolve => require(['@/views/study/detail-file'], resolve)
        }

      ]
    },
    {
      path: '/my',
      component: resolve => require(['@/views/header'], resolve),
      children: [
        {
          path: 'collect',
          name: 'collect',
          meta: {
            title: '我的收藏',
            keepAlive: true
          },
          component: resolve => require(['@/views/mine/my-collect'], resolve)
        },
        {
          path: 'info',
          meta: {
            title: '个人信息'
          },
          component: resolve => require(['@/views/mine/my-info'], resolve)
        },
        {
          path: 'address-book',
          meta: {
            title: '通讯录'
          },
          component: resolve => require(['@/views/mine/address-book'], resolve)
        },
        {
          path: 'score',
          meta: {
            title: '我的积分'
          },
          component: resolve => require(['@/views/mine/my-score'], resolve)
        },
        {
          path: 'message',
          meta: {
            title: '消息'
          },
          component: resolve => require(['@/views/mine/message'], resolve)
        },
        {
          path: 'download',
          meta: {
            title: '下载'
          },
          component: resolve => require(['@/views/mine/download'], resolve)
        },
        {
          path: 'standing-book',
          meta: {
            title: '学习台账'
          },
          component: resolve => require(['@/views/mine/standing-book'], resolve)
        },
        {
          path: 'advise',
          meta: {
            title: '我要反馈'
          },
          component: resolve => require(['@/views/mine/advise'], resolve)
        }
      ]
    }
  ]
})
